package org.yelongframework.excel.data.collect.sheet.mode.all;

import java.util.List;

import org.yelongframework.excel.cell.ExcelCell;
import org.yelongframework.excel.data.SheetData;
import org.yelongframework.excel.data.SheetDatas;
import org.yelongframework.excel.data.collect.sheet.SheetDataCollectException;
import org.yelongframework.excel.row.ExcelRow;
import org.yelongframework.excel.sheet.ExcelSheet;

/**
 * 默认实现
 * 
 * @since 1.0.0
 */
public class DefaultAllSheetDataCollector extends AbstractAllSheetDataCollector {

	// ==================================================执行收集==================================================

	@Override
	protected SheetDatas doCollect(ExcelSheet excelSheet, AllSheetDataCollectScheme sheetDataCollectScheme)
			throws SheetDataCollectException {
		SheetDatas sheetDatas = new SheetDatas(excelSheet.getSheetIndex());
		List<ExcelRow> rowList = excelSheet.getRowList();
		for (ExcelRow row : rowList) {
			List<ExcelCell> cellList = row.getCellList();
			for (ExcelCell cell : cellList) {
				SheetData sheetData = new SheetData(cell.getRowIndex(), cell.getColumnIndex(), cell.getValueString());
				sheetDatas.add(sheetData);
			}
		}
		return sheetDatas;
	}

}
